FROM java
RUN mv /etc/apt/sources.list /etc/apt/sources.list.bak && \
    echo "deb http://mirrors.aliyun.com/debian/ jessie main non-free contrib" >/etc/apt/sources.list && \
    echo "deb http://mirrors.aliyun.com/debian/ jessie-proposed-updates main non-free contrib" >>/etc/apt/sources.list && \
    echo "deb-src http://mirrors.aliyun.com/debian/ jessie main non-free contrib" >>/etc/apt/sources.list && \
    echo "deb-src http://mirrors.aliyun.com/debian/ jessie-proposed-updates main non-free contrib" >>/etc/apt/sources.list
RUN apt-get update
RUN apt-get --yes --force-yes install tesseract-ocr
RUN apt-get --yes --force-yes install tesseract-ocr-chi-sim
ADD node-v8.2.1-linux-x64.tar.gz /opt
RUN ln -s /opt/node-v8.2.1-linux-x64/bin/node /usr/local/bin/node
RUN ln -s /opt/node-v8.2.1-linux-x64/bin/npm /usr/local/bin/npm
RUN apt-get --yes --force-yes install build-essential
ADD freetype-2.8.tar.gz /opt
RUN cd /opt/freetype-2.8 && ./configure && make install
RUN apt-get --yes --force-yes install libfreetype6
ADD Audiveris-linux.tar.gz /opt
WORKDIR /opt/convert-server
ENV SERVER_PORT 3000
ADD package.json /opt/convert-server
ADD .npmrc /opt/convert-server
RUN npm install
ADD . /opt/convert-server
RUN npm run tsc
CMD ["npm", "run", "start:prod"]
